/*-- MG --*/

#strict 
#include WEPN

public func Initialize()
{
SetAction("Be");
return(_inherited());
}

public func FMData1(int data)
{
if(data == FM_Name)      return("Dauerfeuer");
if(data == FM_AmmoID)    return(STAM);
if(data == FM_AmmoLoad)  return(100);
if(data == FM_Reload)    return(250);
if(data == FM_Recharge)  return(4);
if(data == FM_Damage)    return(3);
if(data == FM_Auto)      return(true);

return ( Default(data) );
}

public func Fire1()
{
var user = GetUser();
var dir = GetDir();

var angle = 270 + RandomX(-3,+3);
if(GetDir()) angle = 90 + RandomX(-3,+3);

var x;
x= -15;
if(GetDir()) x = 15;


var ammo = CreateObject(SHT1,x,-7,GetController(user));
ammo->Launch(angle,250,600,3,120, GetFMData(FM_Damage));

MuzzleFlash(35,user,x,-7,angle);
BulletCasing(dir*6,3,-dir*5,-20,5);
}

public func ControlLeft()
{
if(GetDir())
{
SetDir(0);
SetPosition(GetX()-15,GetY());
}
return(1);
}

public func ControlRight()
{
if(!GetDir())
{
SetDir(1);
SetPosition(GetX()+15,GetY());
}
return(1);
}

public func IsBulletTarget() { return(true); }

public func Damage() 
{
if(GetDamage() < 70) return;
Explode(30);
}

public func OnDmg(int iDmg, int iType) //Resistenzen
 {
if(iType == DMG_Bio)        return(70); 
if(iType == DMG_Melee)      return(100);
if(iType == DMG_Fire)       return(-50);
if(iType == DMG_Explosion)  return(-60);
if(iType == DMG_Projectile) return(-20);
if(iType == DMG_Energy)     return(-100);
 }
